package com.ndp.fb.rdb.redis;


import com.alibaba.dubbo.config.annotation.Service;
import com.ndp.fb.constant.CommonConstants;
import com.ndp.fb.rdb.api.VpiInfoRdbService;
import com.ndp.fb.rdb.model.VpiInfo;
import com.ndp.fb.redis.api.RedisClient;
import com.ndp.fb.redis.api.VpiInfoRedisService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by jacky.cheng on 2015/4/29.
 */
@Service
public class VpiInfoRedisServiceImpl implements VpiInfoRedisService {
    private Logger logger = LoggerFactory.getLogger(getClass());
    @Autowired
    private RedisClient redisClient;

    @Autowired
    private VpiInfoRdbService rdbService;

    @Override
    public VpiInfo findCache(String connObjId, String platAndCountry) {
        return (VpiInfo) redisClient.hGet(CommonConstants.VPI + connObjId, platAndCountry);
    }

    @Override
    public void saveCache(String connObjId, String platAndCountry, VpiInfo price) {
        redisClient.hSet(CommonConstants.VPI + connObjId, platAndCountry, price);
    }

}
